home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / graphics / gnuplot / contrib / campbell / gplotlib.5 < prev    next >
Encoding:
Internet Message Format  |  1992-04-27  |  55.6 KB

  1. From jdc@naucse.cse.nau.edu Thu Mar  5 09:27:17 1992
  2. Return-Path: <jdc@naucse.cse.nau.edu>
  3. Received: from naucse.cse.nau.edu by ra-next.arc.nasa.gov (NeXT-1.0 (From Sendmail 5.52)/NeXT-1.0)
  4.     id AA10638; Thu, 5 Mar 92 09:27:04 PST
  5. Received: by naucse.cse.nau.edu (5.65c/1.5-nau)
  6.     id AA21546; Thu, 5 Mar 1992 10:32:46 -0700
  7. Message-Id: <199203051732.AA21546@naucse.cse.nau.edu>
  8. From: jdc@naucse.cse.nau.edu (John Campbell)
  9. Date: Thu, 5 Mar 1992 10:32:44 MST
  10. X-Mailer: Mail User's Shell (7.2.3 5/22/91)
  11. To: woo@ra-next.arc.nasa.gov
  12. Subject: gplotlib.shr5
  13. Status: R
  14.  
  15. #! /bin/sh
  16. # This is a shell archive.  Remove anything before this line, then unpack
  17. # it by saving it into a file and typing "sh file".  To overwrite existing
  18. # files, type "sh file -c".  You can also feed this as standard input via
  19. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  20. # will see the following message at the end:
  21. #        "End of archive 5 (of 5)."
  22. # Contents:  gterm.c
  23. # Wrapped by jdc@naucse.cse.nau.edu on Tue Feb 11 08:42:18 1992
  24. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  25. if test -f 'gterm.c' -a "${1}" != "-c" ; then 
  26.   echo shar: Will not clobber existing file \"'gterm.c'\"
  27. else
  28. echo shar: Extracting \"'gterm.c'\" \(53371 characters\)
  29. sed "s/^X//" >'gterm.c' <<'END_OF_FILE'
  30. X/* GNUPLOT - term.c */
  31. X/*
  32. X * Copyright (C) 1986, 1987, 1990, 1991   Thomas Williams, Colin Kelley
  33. X *
  34. X * Permission to use, copy, and distribute this software and its
  35. X * documentation for any purpose with or without fee is hereby granted, 
  36. X * provided that the above copyright notice appear in all copies and 
  37. X * that both that copyright notice and this permission notice appear 
  38. X * in supporting documentation.
  39. X *
  40. X * Permission to modify the software is granted, but not the right to
  41. X * distribute the modified code.  Modifications are to be distributed 
  42. X * as patches to released version.
  43. X *  
  44. X * This software is provided "as is" without express or implied warranty.
  45. X * 
  46. X *
  47. X * AUTHORS
  48. X * 
  49. X *   Original Software:
  50. X *     Thomas Williams,  Colin Kelley.
  51. X * 
  52. X *   Gnuplot 2.0 additions:
  53. X *       Russell Lang, Dave Kotz, John Campbell.
  54. X *
  55. X *   Gnuplot 3.0 additions:
  56. X *       Gershon Elber and many others.
  57. X * 
  58. X * Send your comments or suggestions to 
  59. X *  pixar!info-gnuplot@sun.com.
  60. X * This is a mailing list; to join it send a note to 
  61. X *  pixar!info-gnuplot-request@sun.com.  
  62. X * Send bug reports to
  63. X *  pixar!bug-gnuplot@sun.com.
  64. X */
  65. X
  66. X
  67. X/*-
  68. X    gnuplot Graphics Terminal library: gterm.c
  69. X
  70. X    This module provides access to the gnuplot terminal device drivers
  71. X    as callable routines for 'C' programmers.
  72. X-*/
  73. X
  74. X#include <stdio.h>
  75. X#define GT_OWNER
  76. X#include "gtplot.h"
  77. X#include "setshow.h"
  78. X#include "term.h"
  79. X#include "bitmap.h"
  80. X
  81. X/* Definitions needed to make gterm.c standalone and usable. */
  82. X#define outfile GToutfile   /* Epson and LaTeX drivers. */
  83. X#define term GTterm         
  84. X#define term_tbl GTterm_tbl /* eepic, latex, and sun drivers. */
  85. X#define xsize GTxsize
  86. X#define ysize GTysize       /* Postscript and latex drivers. */
  87. X/* 
  88. X   Only the Epson driver requires this gnuplot alloc (from misc.c) 
  89. X   Maybe a patch can go out to just have it do a malloc for the
  90. X   bitmap?   jdc
  91. X*/
  92. X
  93. X/* alloc:
  94. X * allocate memory 
  95. X * This is a protected version of malloc used throughout gnuplot proper.
  96. X */
  97. X
  98. Xchar *
  99. Xalloc(size, message)
  100. X    unsigned int size;                /* # of bytes */
  101. X    char *message;            /* description of what is being allocated */
  102. X{
  103. X    char *p;                /* the new allocation */
  104. X    extern char *malloc();
  105. X
  106. X    p = malloc(size);
  107. X    if (p == (char *)NULL) {
  108. X      if (message != NULL) {
  109. X         (void) fprintf(stderr, "out of memory for %s", message);
  110. X         exit(1);
  111. X         /* NOTREACHED */
  112. X      }
  113. X          /* else we return NULL */
  114. X    }
  115. X    return(p);
  116. X}
  117. X
  118. X/* Also a fake int_error for the gterm world. */
  119. Xint_error(str,flag)
  120. Xchar *str;
  121. Xint flag;
  122. X{
  123. X   fprintf (stderr, str);
  124. X   exit(1);
  125. X}
  126. X
  127. X/* for use by all drivers */
  128. X#define sign(x) ((x) >= 0 ? 1 : -1)
  129. X#define abs(x) ((x) >= 0 ? (x) : -(x))
  130. X#define max(a,b) ((a) > (b) ? (a) : (b))
  131. X#define min(a,b) ((a) < (b) ? (a) : (b))
  132. X
  133. XBOOLEAN term_init = 0;            /* true if terminal has been initialized */
  134. X
  135. Xextern FILE *outfile;
  136. Xextern char outstr[];
  137. Xextern BOOLEAN term_init;
  138. Xextern int term;
  139. Xextern float xsize, ysize;
  140. X
  141. X/* These need to be "owned" by someone--may as well be gterm.c. */
  142. Xchar input_line[MAX_LINE_LEN];
  143. Xchar term_options[80]='\0';
  144. Xstruct lexical_unit token[MAX_TOKENS];
  145. Xint num_tokens = 0, c_token = 0;
  146. Xextern struct value *const_express();
  147. X
  148. XBOOLEAN interactive = 0;
  149. X
  150. X/*
  151. X * instead of <strings.h>
  152. X */
  153. Xextern char *strcpy();
  154. Xextern int strlen(), strcmp(), strncmp();
  155. X#ifndef AMIGA_AC_5
  156. Xextern double sqrt();
  157. X#endif
  158. X
  159. Xchar *getenv();
  160. X
  161. X#ifdef __TURBOC__
  162. Xchar *turboc_init();
  163. X#endif
  164. X#ifdef PC
  165. Xvoid reopen_binary();
  166. X#endif
  167. X#ifdef vms
  168. Xchar *vms_init();
  169. Xvoid vms_reset();
  170. Xvoid term_mode_tek();
  171. Xvoid term_mode_native();
  172. Xvoid term_pasthru();
  173. Xvoid term_nopasthru();
  174. Xvoid reopen_binary();
  175. Xvoid fflush_binary();
  176. X#endif
  177. X
  178. X/* This is needed because the unixplot library only writes to stdout. */
  179. X#ifdef UNIXPLOT
  180. XFILE save_stdout;
  181. X#endif
  182. Xint unixplot=0;
  183. X
  184. X#define NICE_LINE        0
  185. X#define POINT_TYPES        6
  186. X
  187. X
  188. Xstatic do_point(x,y,number)
  189. Xint x,y;
  190. Xint number;
  191. X{
  192. Xregister int htic,vtic;
  193. Xregister struct termentry *t = &term_tbl[term];
  194. X
  195. X     if (number < 0) {        /* do dot */
  196. X        (*t->move)(x,y);
  197. X        (*t->vector)(x,y);
  198. X        return;
  199. X    }
  200. X
  201. X    number %= POINT_TYPES;
  202. X    htic = (t->h_tic/2);    /* should be in term_tbl[] in later version */
  203. X    vtic = (t->v_tic/2);    
  204. X
  205. X    switch(number) {
  206. X        case 0: /* do diamond */ 
  207. X                (*t->move)(x-htic,y);
  208. X                (*t->vector)(x,y-vtic);
  209. X                (*t->vector)(x+htic,y);
  210. X                (*t->vector)(x,y+vtic);
  211. X                (*t->vector)(x-htic,y);
  212. X                (*t->move)(x,y);
  213. X                (*t->vector)(x,y);
  214. X                break;
  215. X        case 1: /* do plus */ 
  216. X                (*t->move)(x-htic,y);
  217. X                (*t->vector)(x-htic,y);
  218. X                (*t->vector)(x+htic,y);
  219. X                (*t->move)(x,y-vtic);
  220. X                (*t->vector)(x,y-vtic);
  221. X                (*t->vector)(x,y+vtic);
  222. X                break;
  223. X        case 2: /* do box */ 
  224. X                (*t->move)(x-htic,y-vtic);
  225. X                (*t->vector)(x-htic,y-vtic);
  226. X                (*t->vector)(x+htic,y-vtic);
  227. X                (*t->vector)(x+htic,y+vtic);
  228. X                (*t->vector)(x-htic,y+vtic);
  229. X                (*t->vector)(x-htic,y-vtic);
  230. X                (*t->move)(x,y);
  231. X                (*t->vector)(x,y);
  232. X                break;
  233. X        case 3: /* do X */ 
  234. X                (*t->move)(x-htic,y-vtic);
  235. X                (*t->vector)(x-htic,y-vtic);
  236. X                (*t->vector)(x+htic,y+vtic);
  237. X                (*t->move)(x-htic,y+vtic);
  238. X                (*t->vector)(x-htic,y+vtic);
  239. X                (*t->vector)(x+htic,y-vtic);
  240. X                break;
  241. X        case 4: /* do triangle */ 
  242. X                (*t->move)(x,y+(4*vtic/3));
  243. X                (*t->vector)(x-(4*htic/3),y-(2*vtic/3));
  244. X                (*t->vector)(x+(4*htic/3),y-(2*vtic/3));
  245. X                (*t->vector)(x,y+(4*vtic/3));
  246. X                (*t->move)(x,y);
  247. X                (*t->vector)(x,y);
  248. X                break;
  249. X        case 5: /* do star */ 
  250. X                (*t->move)(x-htic,y);
  251. X                (*t->vector)(x-htic,y);
  252. X                (*t->vector)(x+htic,y);
  253. X                (*t->move)(x,y-vtic);
  254. X                (*t->vector)(x,y-vtic);
  255. X                (*t->vector)(x,y+vtic);
  256. X                (*t->move)(x-htic,y-vtic);
  257. X                (*t->vector)(x-htic,y-vtic);
  258. X                (*t->vector)(x+htic,y+vtic);
  259. X                (*t->move)(x-htic,y+vtic);
  260. X                (*t->vector)(x-htic,y+vtic);
  261. X                (*t->vector)(x+htic,y-vtic);
  262. X                break;
  263. X    }
  264. X}
  265. X
  266. X
  267. X/*
  268. X * general point routine
  269. X */
  270. Xstatic line_and_point(x,y,number)
  271. Xint x,y,number;
  272. X{
  273. X    /* temporary(?) kludge to allow terminals with bad linetypes 
  274. X        to make nice marks */
  275. X
  276. X    (*term_tbl[term].linetype)(NICE_LINE);
  277. X    do_point(x,y,number);
  278. X}
  279. X
  280. X/* 
  281. X * general arrow routine
  282. X */
  283. X#define ROOT2 (1.41421)        /* sqrt of 2 */
  284. X
  285. Xstatic do_arrow(sx, sy, ex, ey, head)
  286. X    int sx,sy;            /* start point */
  287. X    int ex, ey;            /* end point (point of arrowhead) */
  288. X    BOOLEAN head;
  289. X{
  290. X    register struct termentry *t = &term_tbl[term];
  291. X    int len = (t->h_tic + t->v_tic)/2; /* arrowhead size = avg of tic sizes */
  292. X
  293. X    /* draw the line for the arrow. That's easy. */
  294. X    (*t->move)(sx, sy);
  295. X    (*t->vector)(ex, ey);
  296. X
  297. X    if (head) {
  298. X    /* now draw the arrow head. */
  299. X    /* we put the arrowhead marks at 45 degrees to line */
  300. X       if (sx == ex) {
  301. X       /* vertical line, special case */
  302. X          int delta = ((float)len / ROOT2 + 0.5);
  303. X          if (sy < ey)
  304. X              delta = -delta;    /* up arrow goes the other way */
  305. X          (*t->move)(ex - delta, ey + delta);
  306. X          (*t->vector)(ex,ey);
  307. X          (*t->vector)(ex + delta, ey + delta);
  308. X       } else {
  309. X          int dx = sx - ex;
  310. X          int dy = sy - ey;
  311. X          double coeff = len / sqrt(2.0*((double)dx*(double)dx 
  312. X                   + (double)dy*(double)dy));
  313. X          int x,y;            /* one endpoint */
  314. X
  315. X          x = (int)( ex + (dx + dy) * coeff );
  316. X          y = (int)( ey + (dy - dx) * coeff );
  317. X          (*t->move)(x,y);
  318. X          (*t->vector)(ex,ey);
  319. X
  320. X          x = (int)( ex + (dx - dy) * coeff );
  321. X          y = (int)( ey + (dy + dx) * coeff );
  322. X          (*t->vector)(x,y);
  323. X       }
  324. X    }
  325. X}
  326. X
  327. X#ifdef DUMB                    /* paper or glass dumb terminal */
  328. X#include "term/dumb.trm"
  329. X#endif
  330. X
  331. X
  332. X#ifdef PC            /* all PC types */
  333. X#include "term/pc.trm"
  334. X#endif
  335. X
  336. X/*
  337. X   all TEK types (TEK,BITGRAPH,KERMIT,VTTEK,SELANAR) are ifdef'd in tek.trm,
  338. X   but most require various TEK routines.  Hence TEK must be defined for
  339. X   the others to compile.
  340. X*/
  341. X#ifdef BITGRAPH
  342. X# ifndef TEK
  343. X#  define TEK
  344. X# endif
  345. X#endif
  346. X
  347. X#ifdef SELENAR
  348. X# ifndef TEK
  349. X#  define TEK
  350. X# endif
  351. X#endif
  352. X
  353. X#ifdef KERMIT
  354. X# ifndef TEK
  355. X#  define TEK
  356. X# endif
  357. X#endif
  358. X
  359. X#ifdef LN03P
  360. X# ifndef TEK
  361. X#  define TEK
  362. X# endif
  363. X#endif
  364. X
  365. X#ifdef VTTEK
  366. X# ifndef TEK
  367. X#  define TEK
  368. X# endif
  369. X#endif
  370. X
  371. X#ifdef T410X        /* Tektronix 4106, 4107, 4109 and 420x terminals */
  372. X#include "term/t410x.trm"
  373. X#endif
  374. X
  375. X#ifdef TEK            /* all TEK types, TEK, BBN, SELANAR, KERMIT, VTTEK */
  376. X#include "term/tek.trm"
  377. X#endif
  378. X
  379. X#ifdef EPSONP    /* bit map types, EPSON, NEC, PROPRINTER, STAR Color */
  380. X#include "term/epson.trm"
  381. X#endif
  382. X
  383. X#ifdef HPLJII        /* HP LaserJet II */
  384. X#include "term/hpljii.trm"
  385. X#endif
  386. X
  387. X#ifdef HPLJII /* HP LaserJet III in HPGL mode */
  388. X#  ifndef HPGL
  389. X#    define HPGL
  390. X#  endif
  391. X#endif
  392. X
  393. X#ifdef FIG                /* Fig 1.4FS Interactive graphics program */
  394. X#include "term/fig.trm"
  395. X#include "term/bigfig.trm"
  396. X#endif
  397. X  
  398. X#ifdef GPR              /* Apollo Graphics Primitive Resource (fixed-size window) */
  399. X#include "term/gpr.trm"
  400. X#endif /* GPR */
  401. X
  402. X#ifdef APOLLO           /* Apollo Graphics Primitive Resource (resizable window) */
  403. X#include "term/apollo.trm"
  404. X#endif /* APOLLO */
  405. X
  406. X#ifdef IMAGEN        /* IMAGEN printer */
  407. X#include "term/imagen.trm"
  408. X#endif
  409. X
  410. X#ifdef EEPIC        /* EEPIC (LATEX) type */
  411. X#include "term/eepic.trm"
  412. X# ifndef LATEX
  413. X#  define LATEX
  414. X# endif
  415. X#endif
  416. X
  417. X#ifdef EMTEX        /* EMTEX (LATEX for PC) type */
  418. X# ifndef LATEX
  419. X#  define LATEX
  420. X# endif
  421. X#endif
  422. X
  423. X#ifdef LATEX        /* LATEX type */
  424. X#include "term/latex.trm"
  425. X#endif
  426. X
  427. X#ifdef POSTSCRIPT    /* POSTSCRIPT type */
  428. X#include "term/post.trm"
  429. X#endif
  430. X
  431. X#ifdef PRESCRIBE    /* PRESCRIBE type */
  432. X#include "term/kyo.trm"
  433. X#endif
  434. X
  435. X#ifdef UNIXPC     /* unix-PC  ATT 7300 or 3b1 machine */
  436. X#include "term/unixpc.trm"
  437. X#endif /* UNIXPC */
  438. X
  439. X#ifdef AED
  440. X#include "term/aed.trm"
  441. X#endif /* AED */
  442. X
  443. X#ifdef CGI
  444. X#include "term/cgi.trm"
  445. X#endif /* CGI */
  446. X
  447. X#ifdef HP2648
  448. X/* also works for HP2647 */
  449. X#include "term/hp2648.trm"
  450. X#endif /* HP2648 */
  451. X
  452. X#ifdef HP26
  453. X#include "term/hp26.trm"
  454. X#endif /* HP26 */
  455. X
  456. X#ifdef HP75
  457. X#ifndef HPGL
  458. X#define HPGL
  459. X#endif
  460. X#endif
  461. X
  462. X/* HPGL - includes HP75 and HPLJIII in HPGL mode */
  463. X#ifdef HPGL
  464. X#include "term/hpgl.trm"
  465. X#endif /* HPGL */
  466. X
  467. X/* Roland DXY800A plotter driver by Martin Yii, eln557h@monu3.OZ 
  468. X    and Russell Lang, rjl@monu1.cc.monash.oz */
  469. X#ifdef DXY800A
  470. X#include "term/dxy.trm"
  471. X#endif /* DXY800A */
  472. X
  473. X#ifdef IRIS4D
  474. X#include "term/iris4d.trm"
  475. X#endif /* IRIS4D */
  476. X
  477. X#ifdef QMS
  478. X#include "term/qms.trm"
  479. X#endif /* QMS */
  480. X
  481. X#ifdef REGIS
  482. X#include "term/regis.trm"
  483. X#endif /* REGIS */
  484. X
  485. X#ifdef SUN
  486. X#include "term/sun.trm"
  487. X#endif /* SUN */
  488. X
  489. X#ifdef VWS
  490. X#include "term/vws.trm"
  491. X#endif /* VWS */
  492. X
  493. X#ifdef V384
  494. X#include "term/v384.trm"
  495. X#endif /* V384 */
  496. X
  497. X#ifdef UNIXPLOT
  498. X#include "term/unixplot.trm"
  499. X#endif /* UNIXPLOT */
  500. X
  501. X#ifdef X11
  502. X#include "term/x11.trm"
  503. X#endif /* X11 */
  504. X
  505. X#ifdef DXF
  506. X#include "term/dxf.trm"
  507. X#endif /* DXF */
  508. X  
  509. X#ifdef AMIGASCREEN
  510. X#include "term/amiga.trm"
  511. X#endif
  512. X
  513. X
  514. X/* Dummy functions for unavailable features */
  515. X
  516. X/* change angle of text.  0 is horizontal left to right.
  517. X* 1 is vertical bottom to top (90 deg rotate)  
  518. X*/
  519. Xstatic int null_text_angle()
  520. X{
  521. Xreturn FALSE ;    /* can't be done */
  522. X}
  523. X
  524. X/* change justification of text.  
  525. X * modes are LEFT (flush left), CENTRE (centred), RIGHT (flush right)
  526. X */
  527. Xstatic int null_justify_text()
  528. X{
  529. Xreturn FALSE ;    /* can't be done */
  530. X}
  531. X
  532. X
  533. X/* Change scale of plot.
  534. X * Parameters are x,y scaling factors for this plot.
  535. X * Some terminals (eg latex) need to do scaling themselves.
  536. X */
  537. Xstatic int null_scale()
  538. X{
  539. Xreturn FALSE ;    /* can't be done */
  540. X}
  541. X
  542. Xstatic int do_scale()
  543. X{
  544. Xreturn TRUE ;    /* can be done */
  545. X}
  546. X
  547. Xstatic options_null()
  548. X{
  549. X    term_options[0] = '\0';    /* we have no options */
  550. X}
  551. X
  552. Xstatic UNKNOWN_null()
  553. X{
  554. X}
  555. X
  556. X/*
  557. X * term_tbl[] contains an entry for each terminal.  "unknown" must be the
  558. X *   first, since term is initialized to 0.
  559. X */
  560. Xstruct termentry term_tbl[] = {
  561. X    {"unknown", "Unknown terminal type - not a plotting device",
  562. X      100, 100, 1, 1,
  563. X      1, 1, options_null, UNKNOWN_null, UNKNOWN_null, 
  564. X      UNKNOWN_null, null_scale, UNKNOWN_null, UNKNOWN_null, UNKNOWN_null, 
  565. X      UNKNOWN_null, UNKNOWN_null, null_text_angle, 
  566. X      null_justify_text, UNKNOWN_null, UNKNOWN_null}
  567. X
  568. X#ifdef AMIGASCREEN
  569. X    ,{"amiga", "Amiga Custom Screen",
  570. X       AMIGA_XMAX, AMIGA_YMAX, AMIGA_VCHAR, AMIGA_HCHAR, 
  571. X       AMIGA_VTIC, AMIGA_HTIC, options_null, AMIGA_init, AMIGA_reset, 
  572. X       AMIGA_text, null_scale, AMIGA_graphics, AMIGA_move, AMIGA_vector,
  573. X       AMIGA_linetype, AMIGA_put_text, null_text_angle, 
  574. X       AMIGA_justify_text, do_point, do_arrow}
  575. X#endif
  576. X
  577. X#ifdef DUMB
  578. X    ,{"dumb", "printer or glass dumb terminal",
  579. X         DUMB_XMAX, DUMB_YMAX, 1, 1,
  580. X         1, 1, DUMB_options, DUMB_init, DUMB_reset,
  581. X         DUMB_text, null_scale, DUMB_graphics, DUMB_move, DUMB_vector,
  582. X         DUMB_linetype, DUMB_put_text, null_text_angle,
  583. X         null_justify_text, DUMB_point, DUMB_arrow}
  584. X#endif
  585. X
  586. X#ifdef PC
  587. X#ifdef __TURBOC__
  588. X
  589. X    ,{"egalib", "IBM PC/Clone with EGA graphics board",
  590. X       EGALIB_XMAX, EGALIB_YMAX, EGALIB_VCHAR, EGALIB_HCHAR,
  591. X       EGALIB_VTIC, EGALIB_HTIC, options_null, EGALIB_init, EGALIB_reset,
  592. X       EGALIB_text, null_scale, EGALIB_graphics, EGALIB_move, EGALIB_vector,
  593. X       EGALIB_linetype, EGALIB_put_text, EGALIB_text_angle, 
  594. X       EGALIB_justify_text, do_point, do_arrow}
  595. X
  596. X    ,{"vgalib", "IBM PC/Clone with VGA graphics board",
  597. X       VGA_XMAX, VGA_YMAX, VGA_VCHAR, VGA_HCHAR,
  598. X       VGA_VTIC, VGA_HTIC, options_null, VGA_init, VGA_reset,
  599. X       VGA_text, null_scale, VGA_graphics, VGA_move, VGA_vector,
  600. X       VGA_linetype, VGA_put_text, VGA_text_angle, 
  601. X       VGA_justify_text, do_point, do_arrow}
  602. X
  603. X    ,{"vgamono", "IBM PC/Clone with VGA Monochrome graphics board",
  604. X       VGA_XMAX, VGA_YMAX, VGA_VCHAR, VGA_HCHAR,
  605. X       VGA_VTIC, VGA_HTIC, options_null, VGA_init, VGA_reset,
  606. X       VGA_text, null_scale, VGA_graphics, VGA_move, VGA_vector,
  607. X       VGAMONO_linetype, VGA_put_text, VGA_text_angle, 
  608. X       VGA_justify_text, line_and_point, do_arrow}
  609. X
  610. X    ,{"svga", "IBM PC/Clone with Super VGA graphics board",
  611. X       SVGA_XMAX, SVGA_YMAX, SVGA_VCHAR, SVGA_HCHAR,
  612. X       SVGA_VTIC, SVGA_HTIC, options_null, SVGA_init, SVGA_reset,
  613. X       SVGA_text, null_scale, SVGA_graphics, SVGA_move, SVGA_vector,
  614. X       SVGA_linetype, SVGA_put_text, SVGA_text_angle, 
  615. X       SVGA_justify_text, do_point, do_arrow}
  616. X
  617. X    ,{"mcga", "IBM PC/Clone with MCGA graphics board",
  618. X       MCGA_XMAX, MCGA_YMAX, MCGA_VCHAR, MCGA_HCHAR,
  619. X       MCGA_VTIC, MCGA_HTIC, options_null, MCGA_init, MCGA_reset,
  620. X       MCGA_text, null_scale, MCGA_graphics, MCGA_move, MCGA_vector,
  621. X       MCGA_linetype, MCGA_put_text, MCGA_text_angle, 
  622. X       MCGA_justify_text, line_and_point, do_arrow}
  623. X
  624. X    ,{"cga", "IBM PC/Clone with CGA graphics board",
  625. X       CGA_XMAX, CGA_YMAX, CGA_VCHAR, CGA_HCHAR,
  626. X       CGA_VTIC, CGA_HTIC, options_null, CGA_init, CGA_reset,
  627. X       CGA_text, null_scale, CGA_graphics, CGA_move, CGA_vector,
  628. X       CGA_linetype, CGA_put_text, MCGA_text_angle, 
  629. X       CGA_justify_text, line_and_point, do_arrow}
  630. X
  631. X    ,{"hercules", "IBM PC/Clone with Hercules graphics board",
  632. X       HERC_XMAX, HERC_YMAX, HERC_VCHAR, HERC_HCHAR,
  633. X       HERC_VTIC, HERC_HTIC, options_null, HERC_init, HERC_reset,
  634. X       HERC_text, null_scale, HERC_graphics, HERC_move, HERC_vector,
  635. X       HERC_linetype, HERC_put_text, MCGA_text_angle, 
  636. X       HERC_justify_text, line_and_point, do_arrow}
  637. X#ifdef ATT6300
  638. X    ,{"att", "IBM PC/Clone with AT&T 6300 graphics board",
  639. X       ATT_XMAX, ATT_YMAX, ATT_VCHAR, ATT_HCHAR,
  640. X       ATT_VTIC, ATT_HTIC, options_null, ATT_init, ATT_reset,
  641. X       ATT_text, null_scale, ATT_graphics, ATT_move, ATT_vector,
  642. X       ATT_linetype, ATT_put_text, ATT_text_angle, 
  643. X       ATT_justify_text, line_and_point, do_arrow}
  644. X#endif
  645. X#else                    /* TURBO */
  646. X
  647. X    ,{"cga", "IBM PC/Clone with CGA graphics board",
  648. X       CGA_XMAX, CGA_YMAX, CGA_VCHAR, CGA_HCHAR,
  649. X       CGA_VTIC, CGA_HTIC, options_null, CGA_init, CGA_reset,
  650. X       CGA_text, null_scale, CGA_graphics, CGA_move, CGA_vector,
  651. X       CGA_linetype, CGA_put_text, CGA_text_angle, 
  652. X       null_justify_text, line_and_point, do_arrow}
  653. X
  654. X    ,{"egabios", "IBM PC/Clone with EGA graphics board (BIOS)",
  655. X       EGA_XMAX, EGA_YMAX, EGA_VCHAR, EGA_HCHAR,
  656. X       EGA_VTIC, EGA_HTIC, options_null, EGA_init, EGA_reset,
  657. X       EGA_text, null_scale, EGA_graphics, EGA_move, EGA_vector,
  658. X       EGA_linetype, EGA_put_text, EGA_text_angle, 
  659. X       null_justify_text, do_point, do_arrow}
  660. X
  661. X    ,{"vgabios", "IBM PC/Clone with VGA graphics board (BIOS)",
  662. X       VGA_XMAX, VGA_YMAX, VGA_VCHAR, VGA_HCHAR,
  663. X       VGA_VTIC, VGA_HTIC, options_null, VGA_init, VGA_reset,
  664. X       VGA_text, null_scale, VGA_graphics, VGA_move, VGA_vector,
  665. X       VGA_linetype, VGA_put_text, VGA_text_angle, 
  666. X       null_justify_text, do_point, do_arrow}
  667. X
  668. X#ifdef EGALIB
  669. X    ,{"egalib", "IBM PC/Clone with EGA graphics board (LIB)",
  670. X       EGALIB_XMAX, EGALIB_YMAX, EGALIB_VCHAR, EGALIB_HCHAR,
  671. X       EGALIB_VTIC, EGALIB_HTIC, options_null, EGALIB_init, EGALIB_reset,
  672. X       EGALIB_text, null_scale, EGALIB_graphics, EGALIB_move, EGALIB_vector,
  673. X       EGALIB_linetype, EGALIB_put_text, null_text_angle, 
  674. X       null_justify_text, do_point, do_arrow}
  675. X#endif
  676. X
  677. X#ifdef HERCULES
  678. X    ,{"hercules", "IBM PC/Clone with Hercules graphics board",
  679. X       HERC_XMAX, HERC_YMAX, HERC_VCHAR, HERC_HCHAR,
  680. X       HERC_VTIC, HERC_HTIC, options_null, HERC_init, HERC_reset,
  681. X       HERC_text, null_scale, HERC_graphics, HERC_move, HERC_vector,
  682. X       HERC_linetype, HERC_put_text, HERC_text_angle, 
  683. X       null_justify_text, line_and_point, do_arrow}
  684. X#endif                    /* HERCULES */
  685. X
  686. X#ifdef ATT6300
  687. X    ,{"att", "AT&T PC/6300 graphics",
  688. X       ATT_XMAX, ATT_YMAX, ATT_VCHAR, ATT_HCHAR,
  689. X       ATT_VTIC, ATT_HTIC, options_null, ATT_init, ATT_reset,
  690. X       ATT_text, null_scale, ATT_graphics, ATT_move, ATT_vector,
  691. X       ATT_linetype, ATT_put_text, ATT_text_angle, 
  692. X       null_justify_text, line_and_point, do_arrow}
  693. X#endif
  694. X
  695. X#ifdef CORONA
  696. X    ,{"corona325", "Corona graphics ???",
  697. X       COR_XMAX, COR_YMAX, COR_VCHAR, COR_HCHAR,
  698. X       COR_VTIC, COR_HTIC, options_null, COR_init, COR_reset,
  699. X       COR_text, null_scale, COR_graphics, COR_move, COR_vector,
  700. X       COR_linetype, COR_put_text, COR_text_angle, 
  701. X       null_justify_text, line_and_point, do_arrow}
  702. X#endif                    /* CORONA */
  703. X#endif                    /* TURBO */
  704. X#endif                    /* PC */
  705. X
  706. X#ifdef AED
  707. X    ,{"aed512", "AED 512 Terminal",
  708. X       AED5_XMAX, AED_YMAX, AED_VCHAR, AED_HCHAR,
  709. X       AED_VTIC, AED_HTIC, options_null, AED_init, AED_reset, 
  710. X       AED_text, null_scale, AED_graphics, AED_move, AED_vector, 
  711. X       AED_linetype, AED_put_text, null_text_angle, 
  712. X       null_justify_text, do_point, do_arrow}
  713. X    ,{"aed767", "AED 767 Terminal",
  714. X       AED_XMAX, AED_YMAX, AED_VCHAR, AED_HCHAR,
  715. X       AED_VTIC, AED_HTIC, options_null, AED_init, AED_reset, 
  716. X       AED_text, null_scale, AED_graphics, AED_move, AED_vector, 
  717. X       AED_linetype, AED_put_text, null_text_angle, 
  718. X       null_justify_text, do_point, do_arrow}
  719. X#endif
  720. X
  721. X#ifdef APOLLO
  722. X       ,{"apollo", "Apollo Graphics Primitive Resource, rescaling of subsequent plots after window resizing",
  723. X       0, 0, 0, 0, /* APOLLO_XMAX, APOLLO_YMAX, APOLLO_VCHAR, APOLLO_HCHAR, are filled in at run-time */
  724. X       APOLLO_VTIC, APOLLO_HTIC, options_null, APOLLO_init, APOLLO_reset,
  725. X       APOLLO_text, null_scale, APOLLO_graphics, APOLLO_move, APOLLO_vector,
  726. X       APOLLO_linetype, APOLLO_put_text, APOLLO_text_angle,
  727. X       APOLLO_justify_text, line_and_point, do_arrow}
  728. X#endif
  729. X
  730. X#ifdef GPR
  731. X       ,{"gpr", "Apollo Graphics Primitive Resource, fixed-size window",
  732. X       GPR_XMAX, GPR_YMAX, GPR_VCHAR, GPR_HCHAR,
  733. X       GPR_VTIC, GPR_HTIC, options_null, GPR_init, GPR_reset,
  734. X       GPR_text, null_scale, GPR_graphics, GPR_move, GPR_vector,
  735. X       GPR_linetype, GPR_put_text, GPR_text_angle,
  736. X       GPR_justify_text, line_and_point, do_arrow}
  737. X#endif
  738. X
  739. X#ifdef BITGRAPH
  740. X    ,{"bitgraph", "BBN Bitgraph Terminal",
  741. X       BG_XMAX,BG_YMAX,BG_VCHAR, BG_HCHAR, 
  742. X       BG_VTIC, BG_HTIC, options_null, BG_init, BG_reset, 
  743. X       BG_text, null_scale, BG_graphics, BG_move, BG_vector,
  744. X       BG_linetype, BG_put_text, null_text_angle, 
  745. X       null_justify_text, line_and_point, do_arrow}
  746. X#endif
  747. X
  748. X#ifdef CGI
  749. X    ,{"cgi", "SCO CGI drivers (requires CGIDISP or CGIPRNT env variable)",
  750. X       CGI_XMAX, CGI_YMAX, 0, 0, 
  751. X       CGI_VTIC, 0, options_null, CGI_init, CGI_reset, 
  752. X       CGI_text, null_scale, CGI_graphics, CGI_move, CGI_vector, 
  753. X       CGI_linetype, CGI_put_text, CGI_text_angle, 
  754. X       CGI_justify_text, CGI_point, do_arrow}
  755. X
  756. X    ,{"hcgi", "SCO CGI drivers (hardcopy, requires CGIPRNT env variable)",
  757. X       CGI_XMAX, CGI_YMAX, 0, 0, 
  758. X       CGI_VTIC, 0, options_null, HCGI_init, CGI_reset, 
  759. X       CGI_text, null_scale, CGI_graphics, CGI_move, CGI_vector, 
  760. X       CGI_linetype, CGI_put_text, CGI_text_angle, 
  761. X       CGI_justify_text, CGI_point, do_arrow}
  762. X#endif
  763. X
  764. X#ifdef DXF
  765. X    ,{"dxf", "dxf-file for AutoCad (default size 120x80)",
  766. X       DXF_XMAX,DXF_YMAX,DXF_VCHAR, DXF_HCHAR,
  767. X       DXF_VTIC, DXF_HTIC, options_null,DXF_init, DXF_reset,
  768. X       DXF_text, null_scale, DXF_graphics, DXF_move, DXF_vector,
  769. X       DXF_linetype, DXF_put_text, DXF_text_angle,
  770. X       DXF_justify_text, do_point, do_arrow}
  771. X#endif
  772. X
  773. X#ifdef DXY800A
  774. X    ,{"dxy800a", "Roland DXY800A plotter",
  775. X       DXY_XMAX, DXY_YMAX, DXY_VCHAR, DXY_HCHAR,
  776. X       DXY_VTIC, DXY_HTIC, options_null, DXY_init, DXY_reset,
  777. X       DXY_text, null_scale, DXY_graphics, DXY_move, DXY_vector,
  778. X       DXY_linetype, DXY_put_text, DXY_text_angle, 
  779. X       null_justify_text, do_point, do_arrow}
  780. X#endif
  781. X
  782. X#ifdef EEPIC
  783. X    ,{"eepic", "EEPIC -- extended LaTeX picture environment",
  784. X       EEPIC_XMAX, EEPIC_YMAX, EEPIC_VCHAR, EEPIC_HCHAR, 
  785. X       EEPIC_VTIC, EEPIC_HTIC, options_null, EEPIC_init, EEPIC_reset, 
  786. X       EEPIC_text, EEPIC_scale, EEPIC_graphics, EEPIC_move, EEPIC_vector, 
  787. X       EEPIC_linetype, EEPIC_put_text, EEPIC_text_angle, 
  788. X       EEPIC_justify_text, EEPIC_point, EEPIC_arrow}
  789. X#endif
  790. X
  791. X#ifdef EMTEX
  792. X   
  793. X    ,{"emtex", "LATEX picture environment with emTeX specials",
  794. X       LATEX_XMAX, LATEX_YMAX, LATEX_VCHAR, LATEX_HCHAR, 
  795. X       LATEX_VTIC, LATEX_HTIC, options_null, EMTEX_init, EMTEX_reset, 
  796. X       EMTEX_text, LATEX_scale, LATEX_graphics, LATEX_move, LATEX_vector, 
  797. X       LATEX_linetype, LATEX_put_text, LATEX_text_angle, 
  798. X       LATEX_justify_text, LATEX_point, LATEX_arrow}
  799. X#endif
  800. X
  801. X#ifdef EPS60
  802. X    ,{"epson_60dpi", "Epson-style 60-dot per inch printers",
  803. X       EPS60XMAX, EPS60YMAX, EPSONVCHAR, EPSONHCHAR,
  804. X       EPSONVTIC, EPSONHTIC, options_null, EPSONinit, EPSONreset,
  805. X       EPS60text, null_scale, EPS60graphics, EPSONmove, EPSONvector,
  806. X       EPSONlinetype, EPSONput_text, EPSON_text_angle,
  807. X       null_justify_text, do_point, do_arrow}
  808. X#endif
  809. X
  810. X#ifdef EPSONP
  811. X    ,{"epson_lx800", "Epson LX-800, Star NL-10, NX-1000, PROPRINTER ...",
  812. X       EPSONXMAX, EPSONYMAX, EPSONVCHAR, EPSONHCHAR, 
  813. X       EPSONVTIC, EPSONHTIC, options_null, EPSONinit, EPSONreset, 
  814. X       EPSONtext, null_scale, EPSONgraphics, EPSONmove, EPSONvector, 
  815. X       EPSONlinetype, EPSONput_text, EPSON_text_angle, 
  816. X       null_justify_text, line_and_point, do_arrow}
  817. X#endif
  818. X
  819. X#ifdef FIG
  820. X    ,{"fig", "FIG graphics language: SunView or X graphics editor",
  821. X       FIG_XMAX, FIG_YMAX, FIG_VCHAR, FIG_HCHAR, 
  822. X       FIG_VTIC, FIG_HTIC, options_null, FIG_init, FIG_reset, 
  823. X       FIG_text, null_scale, FIG_graphics, FIG_move, FIG_vector, 
  824. X       FIG_linetype, FIG_put_text, FIG_text_angle, 
  825. X       FIG_justify_text, do_point, FIG_arrow}
  826. X    ,{"bfig", "FIG graphics language: SunView or X graphics editor. Large Graph",
  827. X       BFIG_XMAX, BFIG_YMAX, BFIG_VCHAR, BFIG_HCHAR, 
  828. X       BFIG_VTIC, BFIG_HTIC, options_null, FIG_init, FIG_reset, 
  829. X       FIG_text, null_scale, FIG_graphics, FIG_move, BFIG_vector, 
  830. X       FIG_linetype, BFIG_put_text, FIG_text_angle, 
  831. X       FIG_justify_text, do_point, BFIG_arrow}
  832. X#endif
  833. X
  834. X#ifdef HP26
  835. X    ,{"hp2623A", "HP2623A and maybe others",
  836. X       HP26_XMAX, HP26_YMAX, HP26_VCHAR, HP26_HCHAR,
  837. X       HP26_VTIC, HP26_HTIC, options_null, HP26_init, HP26_reset,
  838. X       HP26_text, null_scale, HP26_graphics, HP26_move, HP26_vector,
  839. X       HP26_linetype, HP26_put_text, null_text_angle, 
  840. X       null_justify_text, line_and_point, do_arrow}
  841. X#endif
  842. X
  843. X#ifdef HP2648
  844. X    ,{"hp2648", "HP2648 and HP2647",
  845. X       HP2648XMAX, HP2648YMAX, HP2648VCHAR, HP2648HCHAR, 
  846. X       HP2648VTIC, HP2648HTIC, options_null, HP2648init, HP2648reset, 
  847. X       HP2648text, null_scale, HP2648graphics, HP2648move, HP2648vector, 
  848. X       HP2648linetype, HP2648put_text, HP2648_text_angle, 
  849. X       null_justify_text, line_and_point, do_arrow}
  850. X#endif
  851. X
  852. X#ifdef HP75
  853. X    ,{"hp7580B", "HP7580, and probably other HPs (4 pens)",
  854. X       HPGL_XMAX, HPGL_YMAX, HPGL_VCHAR, HPGL_HCHAR,
  855. X       HPGL_VTIC, HPGL_HTIC, options_null, HPGL_init, HPGL_reset,
  856. X       HPGL_text, null_scale, HPGL_graphics, HPGL_move, HPGL_vector,
  857. X       HP75_linetype, HPGL_put_text, HPGL_text_angle, 
  858. X       null_justify_text, do_point, do_arrow}
  859. X#endif
  860. X
  861. X#ifdef HPGL
  862. X    ,{"hpgl", "HP7475 and (hopefully) lots of others (6 pens)",
  863. X       HPGL_XMAX, HPGL_YMAX, HPGL_VCHAR, HPGL_HCHAR,
  864. X       HPGL_VTIC, HPGL_HTIC, options_null, HPGL_init, HPGL_reset,
  865. X       HPGL_text, null_scale, HPGL_graphics, HPGL_move, HPGL_vector,
  866. X       HPGL_linetype, HPGL_put_text, HPGL_text_angle, 
  867. X       null_justify_text, do_point, do_arrow}
  868. X#endif
  869. X
  870. X#ifdef HPLJII
  871. X    ,{"hpljii", "HP Laserjet series II, [75 100 150 300]",
  872. X       HPLJII_75PPI_XMAX, HPLJII_75PPI_YMAX, HPLJII_75PPI_VCHAR,
  873. X       HPLJII_75PPI_HCHAR, HPLJII_75PPI_VTIC, HPLJII_75PPI_HTIC, HPLJIIoptions,
  874. X       HPLJIIinit, HPLJIIreset, HPLJIItext, null_scale,
  875. X       HPLJIIgraphics, HPLJIImove, HPLJIIvector, HPLJIIlinetype,
  876. X       HPLJIIput_text, HPLJIItext_angle, null_justify_text, line_and_point,
  877. X       do_arrow}
  878. X    ,{"hpdj", "HP DeskJet 500, [75 100 150 300]",
  879. X       HPLJII_75PPI_XMAX, HPLJII_75PPI_YMAX, HPLJII_75PPI_VCHAR,
  880. X       HPLJII_75PPI_HCHAR, HPLJII_75PPI_VTIC, HPLJII_75PPI_HTIC, HPLJIIoptions,
  881. X       HPLJIIinit, HPLJIIreset, HPDJtext, null_scale,
  882. X       HPDJgraphics, HPLJIImove, HPLJIIvector, HPLJIIlinetype,
  883. X       HPDJput_text, HPDJtext_angle, null_justify_text, line_and_point,
  884. X       do_arrow}
  885. X#endif
  886. X
  887. X#ifdef HPLJIII
  888. X    ,{"hpljiii_port", "HP laserjet iii (using HPGL plot vectors), portrait mode",
  889. X    HPGL_XMAX, HPGL_YMAX, HPGL_VCHAR, HPGL_HCHAR,
  890. X    HPGL_VTIC, HPGL_HTIC, options_null, HPLJIII_PORT_init, HPLJIII_reset,
  891. X    HPGL_text, null_scale, HPGL_graphics, HPGL_move, HPGL_vector,
  892. X    HPGL_linetype, HPGL_put_text, HPGL_text_angle,
  893. X    null_justify_text, do_point, do_arrow}
  894. X     ,{"hpljiii_land", "HP laserjet iii (using HPGL plot vectors), landscape mode",
  895. X    HPGL_XMAX, HPGL_YMAX, HPGL_VCHAR, HPGL_HCHAR,
  896. X    HPGL_VTIC, HPGL_HTIC, options_null, HPLJIII_LAND_init, HPLJIII_reset,
  897. X    HPGL_text, null_scale, HPGL_graphics, HPGL_move, HPGL_vector,
  898. X    HPGL_linetype, HPGL_put_text, HPGL_text_angle,
  899. X    null_justify_text, do_point, do_arrow}
  900. X#endif
  901. X
  902. X#ifdef IMAGEN
  903. X    ,{"imagen", "Imagen laser printer",
  904. X       IMAGEN_XMAX, IMAGEN_YMAX, IMAGEN_VCHAR, IMAGEN_HCHAR, 
  905. X       IMAGEN_VTIC, IMAGEN_HTIC, options_null, IMAGEN_init, IMAGEN_reset, 
  906. X       IMAGEN_text, null_scale, IMAGEN_graphics, IMAGEN_move, 
  907. X       IMAGEN_vector, IMAGEN_linetype, IMAGEN_put_text, IMAGEN_text_angle,
  908. X       IMAGEN_justify_text, line_and_point, do_arrow}
  909. X#endif
  910. X
  911. X#ifdef IRIS4D
  912. X    ,{"iris4d", "Silicon Graphics IRIS 4D Series Computer",
  913. X       IRIS4D_XMAX, IRIS4D_YMAX, IRIS4D_VCHAR, IRIS4D_HCHAR, 
  914. X       IRIS4D_VTIC, IRIS4D_HTIC, IRIS4D_options, IRIS4D_init, IRIS4D_reset, 
  915. X       IRIS4D_text, null_scale, IRIS4D_graphics, IRIS4D_move, IRIS4D_vector,
  916. X       IRIS4D_linetype, IRIS4D_put_text, null_text_angle, 
  917. X       null_justify_text, do_point, do_arrow}
  918. X#endif
  919. X
  920. X#ifdef KERMIT
  921. X    ,{"kc_tek40xx", "Kermit-MS tek40xx terminal emulator - color",
  922. X       TEK40XMAX,TEK40YMAX,TEK40VCHAR, KTEK40HCHAR, 
  923. X       TEK40VTIC, TEK40HTIC, options_null, TEK40init, KTEK40reset, 
  924. X       KTEK40Ctext, null_scale, KTEK40graphics, TEK40move, TEK40vector, 
  925. X       KTEK40Clinetype, TEK40put_text, null_text_angle, 
  926. X       null_justify_text, do_point, do_arrow}
  927. X    ,{"km_tek40xx", "Kermit-MS tek40xx terminal emulator - monochrome",
  928. X       TEK40XMAX,TEK40YMAX,TEK40VCHAR, KTEK40HCHAR, 
  929. X       TEK40VTIC, TEK40HTIC, options_null, TEK40init, KTEK40reset, 
  930. X       TEK40text, null_scale, KTEK40graphics, TEK40move, TEK40vector, 
  931. X       KTEK40Mlinetype, TEK40put_text, null_text_angle, 
  932. X       null_justify_text, line_and_point, do_arrow}
  933. X#endif
  934. X
  935. X#ifdef LATEX
  936. X    ,{"latex", "LaTeX picture environment",
  937. X       LATEX_XMAX, LATEX_YMAX, LATEX_VCHAR, LATEX_HCHAR, 
  938. X       LATEX_VTIC, LATEX_HTIC, options_null, LATEX_init, LATEX_reset, 
  939. X       LATEX_text, LATEX_scale, LATEX_graphics, LATEX_move, LATEX_vector, 
  940. X       LATEX_linetype, LATEX_put_text, LATEX_text_angle, 
  941. X       LATEX_justify_text, LATEX_point, LATEX_arrow}
  942. X#endif
  943. X
  944. X#ifdef LN03P
  945. X     ,{"ln03", "LN03-plus laser printer in tektronix mode",
  946. X    TEK40XMAX, TEK40YMAX, TEK40VCHAR, TEK40HCHAR,
  947. X    TEK40VTIC, TEK40HTIC, options_null, LN03Pinit, LN03Preset,
  948. X    TEK40text, null_scale, TEK40graphics, TEK40move, TEK40vector,
  949. X    TEK40linetype, TEK40put_text, null_text_angle,
  950. X    null_justify_text, line_and_point, do_arrow}
  951. X#endif
  952. X
  953. X#ifdef NEC
  954. X    ,{"nec_cp6m", "NEC printer CP6, Epson LQ-800 Monochrome",
  955. X       NECXMAX, NECYMAX, NECVCHAR, NECHCHAR, 
  956. X       NECVTIC, NECHTIC, options_null, NECinit, NECreset, 
  957. X       NECtext, null_scale, NECMgraphics, NECmove, NECvector, 
  958. X       NECMlinetype, NECput_text, NEC_text_angle, 
  959. X       null_justify_text, line_and_point, do_arrow}
  960. X    ,{"nec_cp6c", "NEC printer CP6 Color",
  961. X       NECXMAX, NECYMAX, NECVCHAR, NECHCHAR, 
  962. X       NECVTIC, NECHTIC, options_null, NECinit, NECreset, 
  963. X       NECtext, null_scale, NECCgraphics, NECmove, NECvector, 
  964. X       NECClinetype, NECput_text, NEC_text_angle, 
  965. X       null_justify_text, do_point, do_arrow}
  966. X    ,{"nec_cp6d", "NEC printer CP6, Epson LQ-800 Draft monochrome",
  967. X       NECXMAX, NECYMAX, NECVCHAR, NECHCHAR, 
  968. X       NECVTIC, NECHTIC, options_null, NECinit, NECreset, 
  969. X       NECdraft_text, null_scale, NECMgraphics, NECmove, NECvector, 
  970. X       NECMlinetype, NECput_text, NEC_text_angle, 
  971. X       null_justify_text, line_and_point, do_arrow}
  972. X#endif
  973. X
  974. X#ifdef POSTSCRIPT
  975. X    ,{"postscript", "PostScript graphics language [mode \042fontname\042 font_size]",
  976. X       PS_XMAX, PS_YMAX, PS_VCHAR, PS_HCHAR, 
  977. X       PS_VTIC, PS_HTIC, PS_options, PS_init, PS_reset, 
  978. X       PS_text, do_scale, PS_graphics, PS_move, PS_vector, 
  979. X       PS_linetype, PS_put_text, PS_text_angle, 
  980. X       PS_justify_text, PS_point, do_arrow}
  981. X#endif
  982. X
  983. X#ifdef PRESCRIBE
  984. X    ,{"prescribe", "Prescribe - for the Kyocera Laser Printer",
  985. X    PRE_XMAX, PRE_YMAX, PRE_VCHAR, PRE_HCHAR, 
  986. X    PRE_VTIC, PRE_HTIC, options_null, PRE_init, PRE_reset, 
  987. X    PRE_text, null_scale, PRE_graphics, PRE_move, PRE_vector, 
  988. X    PRE_linetype, PRE_put_text, null_text_angle, 
  989. X    PRE_justify_text, line_and_point, do_arrow}
  990. X    ,{"kyo", "Kyocera Laser Printer with Courier font",
  991. X    PRE_XMAX, PRE_YMAX, KYO_VCHAR, KYO_HCHAR, 
  992. X    PRE_VTIC, PRE_HTIC, options_null, KYO_init, PRE_reset, 
  993. X    PRE_text, null_scale, PRE_graphics, PRE_move, PRE_vector, 
  994. X    PRE_linetype, PRE_put_text, null_text_angle, 
  995. X    PRE_justify_text, line_and_point, do_arrow}
  996. X#endif /* PRESCRIBE */
  997. X
  998. X#ifdef QMS
  999. X    ,{"qms", "QMS/QUIC Laser printer (also Talaris 1200 and others)",
  1000. X       QMS_XMAX,QMS_YMAX, QMS_VCHAR, QMS_HCHAR, 
  1001. X       QMS_VTIC, QMS_HTIC, options_null, QMS_init,QMS_reset, 
  1002. X       QMS_text, null_scale, QMS_graphics, QMS_move, QMS_vector,
  1003. X       QMS_linetype,QMS_put_text, null_text_angle, 
  1004. X       null_justify_text, line_and_point, do_arrow}
  1005. X#endif
  1006. X
  1007. X#ifdef REGIS
  1008. X    ,{"regis", "REGIS graphics language",
  1009. X       REGISXMAX, REGISYMAX, REGISVCHAR, REGISHCHAR, 
  1010. X       REGISVTIC, REGISHTIC, options_null, REGISinit, REGISreset, 
  1011. X       REGIStext, null_scale, REGISgraphics, REGISmove, REGISvector,
  1012. X       REGISlinetype, REGISput_text, REGIStext_angle, 
  1013. X       null_justify_text, line_and_point, do_arrow}
  1014. X#endif
  1015. X
  1016. X
  1017. X#ifdef SELANAR
  1018. X    ,{"selanar", "Selanar",
  1019. X       TEK40XMAX, TEK40YMAX, TEK40VCHAR, TEK40HCHAR, 
  1020. X       TEK40VTIC, TEK40HTIC, options_null, SEL_init, SEL_reset, 
  1021. X       SEL_text, null_scale, SEL_graphics, TEK40move, TEK40vector, 
  1022. X       TEK40linetype, TEK40put_text, null_text_angle, 
  1023. X       null_justify_text, line_and_point, do_arrow}
  1024. X#endif
  1025. X
  1026. X#ifdef STARC
  1027. X    ,{"starc", "Star Color Printer",
  1028. X       STARCXMAX, STARCYMAX, STARCVCHAR, STARCHCHAR, 
  1029. X       STARCVTIC, STARCHTIC, options_null, STARCinit, STARCreset, 
  1030. X       STARCtext, null_scale, STARCgraphics, STARCmove, STARCvector, 
  1031. X       STARClinetype, STARCput_text, STARC_text_angle, 
  1032. X       null_justify_text, line_and_point, do_arrow}
  1033. X#endif
  1034. X
  1035. X#ifdef SUN
  1036. X    ,{"sun", "SunView window system",
  1037. X       SUN_XMAX, SUN_YMAX, SUN_VCHAR, SUN_HCHAR, 
  1038. X       SUN_VTIC, SUN_HTIC, options_null, SUN_init, SUN_reset, 
  1039. X       SUN_text, null_scale, SUN_graphics, SUN_move, SUN_vector,
  1040. X       SUN_linetype, SUN_put_text, null_text_angle, 
  1041. X       SUN_justify_text, line_and_point, do_arrow}
  1042. X#endif
  1043. X
  1044. X#ifdef VWS
  1045. X    ,{"VWS", "VAX Windowing System (UIS)",
  1046. X           VWS_XMAX, VWS_YMAX, VWS_VCHAR, VWS_HCHAR,
  1047. X           VWS_VTIC, VWS_HTIC, options_null, VWS_init, VWS_reset,
  1048. X           VWS_text, null_scale, VWS_graphics, VWS_move, VWS_vector,
  1049. X           VWS_linetype, VWS_put_text, VWS_text_angle,
  1050. X           VWS_justify_text, do_point, do_arrow}
  1051. X#endif
  1052. X
  1053. X#ifdef TANDY60
  1054. X    ,{"tandy_60dpi", "Tandy DMP-130 series 60-dot per inch graphics",
  1055. X       EPS60XMAX, EPS60YMAX, EPSONVCHAR, EPSONHCHAR,
  1056. X       EPSONVTIC, EPSONHTIC, options_null, EPSONinit, EPSONreset,
  1057. X       TANDY60text, null_scale, EPS60graphics, EPSONmove, EPSONvector,
  1058. X       EPSONlinetype, EPSONput_text, EPSON_text_angle,
  1059. X       null_justify_text, do_point, do_arrow}
  1060. X#endif
  1061. X
  1062. X#ifdef T410X
  1063. X    ,{"tek410x", "Tektronix 4106, 4107, 4109 and 420X terminals",
  1064. X       T410XXMAX, T410XYMAX, T410XVCHAR, T410XHCHAR, 
  1065. X       T410XVTIC, T410XHTIC, options_null, T410X_init, T410X_reset, 
  1066. X       T410X_text, null_scale, T410X_graphics, T410X_move, T410X_vector, 
  1067. X       T410X_linetype, T410X_put_text, T410X_text_angle, 
  1068. X       null_justify_text, T410X_point, do_arrow}
  1069. X#endif
  1070. X
  1071. X#ifdef TEK
  1072. X    ,{"tek40xx", "Tektronix 4010 and others; most TEK emulators",
  1073. X       TEK40XMAX, TEK40YMAX, TEK40VCHAR, TEK40HCHAR, 
  1074. X       TEK40VTIC, TEK40HTIC, options_null, TEK40init, TEK40reset, 
  1075. X       TEK40text, null_scale, TEK40graphics, TEK40move, TEK40vector, 
  1076. X       TEK40linetype, TEK40put_text, null_text_angle, 
  1077. X       null_justify_text, line_and_point, do_arrow}
  1078. X#endif
  1079. X
  1080. X#ifdef UNIXPLOT
  1081. X    ,{"unixplot", "Unix plotting standard (see plot(1))",
  1082. X       UP_XMAX, UP_YMAX, UP_VCHAR, UP_HCHAR, 
  1083. X       UP_VTIC, UP_HTIC, options_null, UP_init, UP_reset, 
  1084. X       UP_text, null_scale, UP_graphics, UP_move, UP_vector, 
  1085. X       UP_linetype, UP_put_text, null_text_angle, 
  1086. X       null_justify_text, line_and_point, do_arrow}
  1087. X#endif
  1088. X    
  1089. X#ifdef UNIXPC
  1090. X    ,{"unixpc", "AT&T 3b1 or AT&T 7300 Unix PC",
  1091. X       uPC_XMAX, uPC_YMAX, uPC_VCHAR, uPC_HCHAR, 
  1092. X       uPC_VTIC, uPC_HTIC, options_null, uPC_init, uPC_reset, 
  1093. X       uPC_text, null_scale, uPC_graphics, uPC_move, uPC_vector,
  1094. X       uPC_linetype, uPC_put_text, uPC_text_angle, 
  1095. X       null_justify_text, line_and_point, do_arrow}
  1096. X#endif
  1097. X
  1098. X#ifdef V384
  1099. X    ,{"vx384", "Vectrix 384 and Tandy color printer",
  1100. X       V384_XMAX, V384_YMAX, V384_VCHAR, V384_HCHAR, 
  1101. X       V384_VTIC, V384_HTIC, options_null, V384_init, V384_reset, 
  1102. X       V384_text, null_scale, V384_graphics, V384_move, V384_vector, 
  1103. X       V384_linetype, V384_put_text, null_text_angle, 
  1104. X       null_justify_text, do_point, do_arrow}
  1105. X#endif
  1106. X
  1107. X#ifdef VTTEK
  1108. X    ,{"vttek", "VT-like tek40xx terminal emulator",
  1109. X       TEK40XMAX,TEK40YMAX,TEK40VCHAR, TEK40HCHAR,
  1110. X       TEK40VTIC, TEK40HTIC, options_null, VTTEK40init, VTTEK40reset,
  1111. X       TEK40text, null_scale, TEK40graphics, TEK40move, TEK40vector,
  1112. X       VTTEK40linetype, VTTEK40put_text, null_text_angle,
  1113. X       null_justify_text, line_and_point, do_arrow}
  1114. X#endif
  1115. X
  1116. X#ifdef X11
  1117. X    ,{"x11", "X11 Window System",
  1118. X       X11_XMAX, X11_YMAX, X11_VCHAR, X11_HCHAR, 
  1119. X       X11_VTIC, X11_HTIC, options_null, X11_init, X11_reset, 
  1120. X       X11_text, null_scale, X11_graphics, X11_move, X11_vector, 
  1121. X       X11_linetype, X11_put_text, null_text_angle, 
  1122. X       X11_justify_text, line_and_point, do_arrow}
  1123. X    ,{"X11", "X11 Window System - multi-color points",
  1124. X       X11_XMAX, X11_YMAX, X11_VCHAR, X11_HCHAR, 
  1125. X       X11_VTIC, X11_HTIC, options_null, X11_init, X11_reset, 
  1126. X       X11_text, null_scale, X11_graphics, X11_move, X11_vector, 
  1127. X       X11_linetype, X11_put_text, null_text_angle, 
  1128. X       X11_justify_text, do_point, do_arrow}
  1129. X#endif
  1130. X};
  1131. X
  1132. X#define TERMCOUNT (sizeof(term_tbl)/sizeof(struct termentry))
  1133. X
  1134. X
  1135. Xgt_list_terms()
  1136. X{
  1137. Xregister int i;
  1138. X
  1139. X    fprintf(stderr,"\nAvailable terminal types:\n");
  1140. X    for (i = 0; i < TERMCOUNT; i++)
  1141. X        fprintf(stderr,"  %15s  %s\n",
  1142. X               term_tbl[i].name, term_tbl[i].description);
  1143. X    (void) putc('\n',stderr);
  1144. X}
  1145. X
  1146. X
  1147. X#ifdef NOT_USED_IN_GPLOTLIB
  1148. X/* set_term: get terminal number from name on command line */
  1149. X/* will change 'term' variable if successful */
  1150. Xint                        /* term number */
  1151. Xset_term(c_token)
  1152. Xint c_token;
  1153. X{
  1154. X    register int t;
  1155. X    char *input_name;
  1156. X
  1157. X    if (!token[c_token].is_token)
  1158. X     int_error("terminal name expected",c_token);
  1159. X    t = -1;
  1160. X    input_name = input_line + token[c_token].start_index;
  1161. X    t = gt_change_term(input_name, token[c_token].length);
  1162. X    if (t == -1)
  1163. X     int_error("unknown terminal type; type just 'set terminal' for a list",
  1164. X             c_token);
  1165. X    if (t == -2)
  1166. X     int_error("ambiguous terminal name; type just 'set terminal' for a list",
  1167. X             c_token);
  1168. X
  1169. X    /* otherwise the type was changed */
  1170. X
  1171. X    return(t);
  1172. X}
  1173. X#endif
  1174. X
  1175. Xgt_change_file (fp)
  1176. XFILE *fp;
  1177. X/*-
  1178. X   Routine to change the file pointer (stream) being used to write
  1179. X   to with gplotlib (GToutfile).  This is generally preferred to just
  1180. X   replacing GToutfile on the fly as it will flush any output and
  1181. X   also handles unixplot files properly.  Note that GSRoutfile is
  1182. X   really the same as GToutfile, so this routine serves the function
  1183. X   of changing the outfile for gsr code also.
  1184. X   Parameter:
  1185. X
  1186. X          fp: New value to use for GToutfile (pointer from fopen()),
  1187. X              if NULL then replace GToutfile with original stdout
  1188. X              value.
  1189. X-*/
  1190. X{
  1191. X/* 
  1192. X   Most of this code is just taken from SET OUTPUT in order to handle
  1193. X   the unixplot redirections.  Guess it's worth it...
  1194. X*/
  1195. X   if (fp == NULL) {
  1196. X      UP_redirect (4);
  1197. X      if (outfile != stdout) /* Never close stdout */
  1198. X         (void) fclose(outfile);
  1199. X      outfile = stdout; /* Don't dup... */
  1200. X      GTterm_init = FALSE;
  1201. X   }
  1202. X   else {
  1203. X      if (outfile != stdout) /* Never close stdout */
  1204. X         (void) fclose(outfile);
  1205. X      outfile = fp;
  1206. X      GTterm_init = FALSE;
  1207. X      UP_redirect (1);
  1208. X   }
  1209. X}
  1210. X
  1211. X/* gt_change_term: get terminal number from name and set terminal type */
  1212. X/* returns -1 if unknown, -2 if ambiguous, >=0 is terminal number */
  1213. Xint
  1214. Xgt_change_term(name, length)
  1215. X    char *name;
  1216. X    int length;
  1217. X{
  1218. X    int i, t = -1;
  1219. X
  1220. X    for (i = 0; i < TERMCOUNT; i++) {
  1221. X       if (!strncmp(name,term_tbl[i].name,length)) {
  1222. X          if (t != -1)
  1223. X            return(-2);    /* ambiguous */
  1224. X          t = i;
  1225. X       }
  1226. X    }
  1227. X
  1228. X    if (t == -1)            /* unknown */
  1229. X     return(t);
  1230. X
  1231. X    /* Success: set terminal type now */
  1232. X
  1233. X    term = t;
  1234. X    term_init = FALSE;
  1235. X    name = term_tbl[term].name;
  1236. X
  1237. X    /* Special handling for unixplot term type */
  1238. X    if (!strncmp("unixplot",name,8)) {
  1239. X       UP_redirect (2);  /* Redirect actual stdout for unixplots */
  1240. X    } else if (unixplot) {
  1241. X       UP_redirect (3);  /* Put stdout back together again. */
  1242. X    }
  1243. X
  1244. X    if (interactive)
  1245. X     fprintf(stderr, "Terminal type set to '%s'\n", name);
  1246. X
  1247. X    return(t);
  1248. X}
  1249. X
  1250. X/*
  1251. X   Routine to detect what terminal is being used (or do anything else
  1252. X   that would be nice).  One anticipated (or allowed for) side effect
  1253. X   is that the global ``term'' may be set. 
  1254. X   The environment variable GNUTERM is checked first; if that does
  1255. X   not exist, then the terminal hardware is checked, if possible, 
  1256. X   and finally, we can check $TERM for some kinds of terminals.
  1257. X*/
  1258. X/* thanks to osupyr!alden (Dave Alden) for the original GNUTERM code */
  1259. Xgt_init_terminal()
  1260. X{
  1261. X    char *term_name = NULL;
  1262. X    int t;
  1263. X    char *term = NULL;        /* from TERM environment var */
  1264. X#ifdef X11
  1265. X    char *display = NULL;
  1266. X#endif
  1267. X    char *gnuterm = NULL;
  1268. X
  1269. X    /* GNUTERM environment variable is primary */
  1270. X    gnuterm = getenv("GNUTERM");
  1271. X    if (gnuterm != (char *)NULL)
  1272. X     term_name = gnuterm;
  1273. X    else {
  1274. X#ifdef __TURBOC__
  1275. X       term_name = turboc_init();
  1276. X       term = (char *)NULL; /* shut up turbo C */
  1277. X#endif
  1278. X       
  1279. X#ifdef vms
  1280. X       term_name = vms_init();
  1281. X#endif
  1282. X       
  1283. X#ifdef SUN
  1284. X       term = getenv("TERM");    /* try $TERM */
  1285. X       if (term_name == (char *)NULL
  1286. X          && term != (char *)NULL && strcmp(term, "sun") == 0)
  1287. X        term_name = "sun";
  1288. X#endif /* sun */
  1289. X
  1290. X#ifdef GPR
  1291. X   if (gpr_isa_pad()) term_name = "gpr";       /* find out whether stdout is a DM pad. See term/gpr.trm */
  1292. X#else
  1293. X#ifdef APOLLO
  1294. X   if (apollo_isa_pad()) term_name = "apollo"; /* find out whether stdout is a DM pad. See term/apollo.trm */
  1295. X#endif /* APOLLO */
  1296. X#endif /* GPR    */
  1297. X
  1298. X#ifdef X11
  1299. X       term = getenv("TERM");    /* try $TERM */
  1300. X       if (term_name == (char *)NULL
  1301. X          && term != (char *)NULL && strcmp(term, "xterm") == 0)
  1302. X        term_name = "x11";
  1303. X       display = getenv("DISPLAY");
  1304. X       if (term_name == (char *)NULL && display != (char *)NULL)
  1305. X        term_name = "x11";
  1306. X#endif /* x11 */
  1307. X
  1308. X#ifdef AMIGASCREEN
  1309. X       term_name = "amiga";
  1310. X#endif
  1311. X
  1312. X#ifdef UNIXPC
  1313. X           if (iswind() == 0) {
  1314. X              term_name = "unixpc";
  1315. X           }
  1316. X#endif /* unixpc */
  1317. X
  1318. X#ifdef CGI
  1319. X       if (getenv("CGIDISP") || getenv("CGIPRNT"))
  1320. X         term_name = "cgi";
  1321. X#endif /*CGI */
  1322. X    }
  1323. X
  1324. X    /* We have a name, try to set term type */
  1325. X    if (term_name != NULL && *term_name != '\0') {
  1326. X       t = gt_change_term(term_name, strlen(term_name));
  1327. X       if (t == -1)
  1328. X        fprintf(stderr, "Unknown terminal name '%s'\n", term_name);
  1329. X       else if (t == -2)
  1330. X        fprintf(stderr, "Ambiguous terminal name '%s'\n", term_name);
  1331. X       else                /* successful */
  1332. X        ;
  1333. X    }
  1334. X}
  1335. X
  1336. X
  1337. X#ifdef __TURBOC__
  1338. Xstatic char *
  1339. Xturboc_init()
  1340. X{
  1341. X  int g_driver,g_mode;
  1342. X  char far *c1,*c2;
  1343. X  char *term_name = NULL;
  1344. X  struct text_info tinfo;       /* So we can restore starting text mode. */
  1345. X
  1346. X/* Some of this code including BGI drivers is copyright Borland Intl. */
  1347. X    g_driver=DETECT;
  1348. X          get_path();
  1349. X    gettextinfo(&tinfo);
  1350. X        initgraph(&g_driver,&g_mode,path);
  1351. X        c1=getdrivername();
  1352. X        c2=getmodename(g_mode);
  1353. X          switch (g_driver){
  1354. X            case -2: fprintf(stderr,"Graphics card not detected.\n");
  1355. X                     break;
  1356. X            case -3: fprintf(stderr,"BGI driver file cannot be found.\n");
  1357. X                     break;
  1358. X            case -4: fprintf(stderr,"Invalid BGI driver file.\n");
  1359. X                     break;
  1360. X            case -5: fprintf(stderr,"Insufficient memory to load ",
  1361. X                             "graphics driver.");
  1362. X                     break;
  1363. X            case 1 : term_name = "cga";
  1364. X                     break;
  1365. X            case 2 : term_name = "mcga";
  1366. X                     break;
  1367. X            case 3 : 
  1368. X            case 4 : term_name = "egalib";
  1369. X                     break;
  1370. X            case 7 : term_name = "hercules";
  1371. X                     break;
  1372. X            case 8 : term_name = "att";
  1373. X                     break;
  1374. X            case 9 : term_name = "vgalib";
  1375. X                     break;
  1376. X            }
  1377. X        closegraph();
  1378. X        textmode(tinfo.currmode);
  1379. X    clrscr();
  1380. X    fprintf(stderr,"\tTC Graphics, driver %s  mode %s\n",c1,c2);
  1381. X  return(term_name);
  1382. X}
  1383. X#endif /* __TURBOC__ */
  1384. X
  1385. X/*
  1386. X    This is always defined so we don't have to have command.c know if it
  1387. X    is there or not.
  1388. X*/
  1389. X#ifndef UNIXPLOT
  1390. XUP_redirect(caller) int caller; 
  1391. X{
  1392. X    caller = caller;    /* to stop Turbo C complaining 
  1393. X                         * about caller not being used */
  1394. X}
  1395. X#else
  1396. XUP_redirect (caller)
  1397. Xint caller;
  1398. X/*
  1399. X    Unixplot can't really write to outfile--it wants to write to stdout.
  1400. X    This is normally ok, but the original design of gnuplot gives us
  1401. X    little choice.  Originally users of unixplot had to anticipate
  1402. X    their needs and redirect all I/O to a file...  Not very gnuplot-like.
  1403. X
  1404. X    caller:  1 - called from SET OUTPUT "FOO.OUT"
  1405. X             2 - called from SET TERM UNIXPLOT
  1406. X             3 - called from SET TERM other
  1407. X             4 - called from SET OUTPUT
  1408. X*/
  1409. X{
  1410. X    switch (caller) {
  1411. X    case 1:
  1412. X    /* Don't save, just replace stdout w/outfile (save was already done). */
  1413. X        if (unixplot)
  1414. X            *(stdout) = *(outfile);  /* Copy FILE structure */
  1415. X    break;
  1416. X    case 2:
  1417. X        if (!unixplot) {
  1418. X            fflush(stdout);
  1419. X            save_stdout = *(stdout);
  1420. X            *(stdout) = *(outfile);  /* Copy FILE structure */
  1421. X            unixplot = 1;
  1422. X        }
  1423. X    break;
  1424. X    case 3:
  1425. X    /* New terminal in use--put stdout back to original. */
  1426. X        closepl();
  1427. X        fflush(stdout);
  1428. X        *(stdout) = save_stdout;  /* Copy FILE structure */
  1429. X        unixplot = 0;
  1430. X    break;
  1431. X    case 4:
  1432. X    /*  User really wants to go to normal output... */
  1433. X        if (unixplot) {
  1434. X            fflush(stdout);
  1435. X            *(stdout) = save_stdout;  /* Copy FILE structure */
  1436. X        }
  1437. X    break;
  1438. X    }
  1439. X}
  1440. X#endif
  1441. X
  1442. X
  1443. X/* test terminal by drawing border and text */
  1444. X/* called from command test */
  1445. Xgt_test_term()
  1446. X{
  1447. X    register struct termentry *t = &term_tbl[term];
  1448. X    char *str;
  1449. X    int x,y, xl,yl, i;
  1450. X    unsigned int xmax, ymax;
  1451. X    char label[MAX_ID_LEN];
  1452. X    int scaling;
  1453. X
  1454. X    if (!term_init) {
  1455. X       (*t->init)();
  1456. X       term_init = TRUE;
  1457. X    }
  1458. X    screen_ok = FALSE;
  1459. X    scaling = (*t->scale)(xsize, ysize);
  1460. X    xmax = (unsigned int)(t->xmax * (scaling ? 1 : xsize));
  1461. X    ymax = (unsigned int)(t->ymax * (scaling ? 1 : ysize));
  1462. X    (*t->graphics)();
  1463. X    /* border linetype */
  1464. X    (*t->linetype)(-2);
  1465. X    (*t->move)(0,0);
  1466. X    (*t->vector)(xmax-1,0);
  1467. X    (*t->vector)(xmax-1,ymax-1);
  1468. X    (*t->vector)(0,ymax-1);
  1469. X    (*t->vector)(0,0);
  1470. X    (void) (*t->justify_text)(LEFT);
  1471. X    (*t->put_text)(t->h_char*5,ymax-t->v_char*3,"Terminal Test");
  1472. X    /* axis linetype */
  1473. X    (*t->linetype)(-1);
  1474. X    (*t->move)(xmax/2,0);
  1475. X    (*t->vector)(xmax/2,ymax-1);
  1476. X    (*t->move)(0,ymax/2);
  1477. X    (*t->vector)(xmax-1,ymax/2);
  1478. X    /* test width and height of characters */
  1479. X    (*t->linetype)(-2);
  1480. X    (*t->move)(  xmax/2-t->h_char*10,ymax/2+t->v_char/2);
  1481. X    (*t->vector)(xmax/2+t->h_char*10,ymax/2+t->v_char/2);
  1482. X    (*t->vector)(xmax/2+t->h_char*10,ymax/2-t->v_char/2);
  1483. X    (*t->vector)(xmax/2-t->h_char*10,ymax/2-t->v_char/2);
  1484. X    (*t->vector)(xmax/2-t->h_char*10,ymax/2+t->v_char/2);
  1485. X    (*t->put_text)(xmax/2-t->h_char*10,ymax/2,
  1486. X        "12345678901234567890");
  1487. X    /* test justification */
  1488. X    (void) (*t->justify_text)(LEFT);
  1489. X    (*t->put_text)(xmax/2,ymax/2+t->v_char*6,"left justified");
  1490. X    str = "centre+d text";
  1491. X    if ((*t->justify_text)(CENTRE))
  1492. X        (*t->put_text)(xmax/2,
  1493. X                ymax/2+t->v_char*5,str);
  1494. X    else
  1495. X        (*t->put_text)(xmax/2-strlen(str)*t->h_char/2,
  1496. X                ymax/2+t->v_char*5,str);
  1497. X    str = "right justified";
  1498. X    if ((*t->justify_text)(RIGHT))
  1499. X        (*t->put_text)(xmax/2,
  1500. X                ymax/2+t->v_char*4,str);
  1501. X    else
  1502. X        (*t->put_text)(xmax/2-strlen(str)*t->h_char,
  1503. X                ymax/2+t->v_char*4,str);
  1504. X    /* test text angle */
  1505. X    str = "rotated ce+ntred text";
  1506. X    if ((*t->text_angle)(1)) {
  1507. X        if ((*t->justify_text)(CENTRE))
  1508. X            (*t->put_text)(t->v_char,
  1509. X                ymax/2,str);
  1510. X        else
  1511. X            (*t->put_text)(t->v_char,
  1512. X                ymax/2-strlen(str)*t->h_char/2,str);
  1513. X    }
  1514. X    else {
  1515. X        (void) (*t->justify_text)(LEFT);
  1516. X        (*t->put_text)(t->h_char*2,ymax/2-t->v_char*2,"Can't rotate text");
  1517. X    }
  1518. X    (void) (*t->justify_text)(LEFT);
  1519. X    (void) (*t->text_angle)(0);
  1520. X    /* test tic size */
  1521. X    (*t->move)(xmax/2+t->h_tic*2,0);
  1522. X    (*t->vector)(xmax/2+t->h_tic*2,t->v_tic);
  1523. X    (*t->move)(xmax/2,t->v_tic*2);
  1524. X    (*t->vector)(xmax/2+t->h_tic,t->v_tic*2);
  1525. X    (*t->put_text)(xmax/2+t->h_tic*2,t->v_tic*2+t->v_char/2,"test tics");
  1526. X    /* test line and point types */
  1527. X    x = xmax - t->h_char*4 - t->h_tic*4;
  1528. X    y = ymax - t->v_char;
  1529. X    for ( i = -2; y > t->v_char; i++ ) {
  1530. X        (*t->linetype)(i);
  1531. X        (void) sprintf(label,"%d",i);
  1532. X        if ((*t->justify_text)(RIGHT))
  1533. X            (*t->put_text)(x,y,label);
  1534. X        else
  1535. X            (*t->put_text)(x-strlen(label)*t->h_char,y,label);
  1536. X        (*t->move)(x+t->h_char,y);
  1537. X        (*t->vector)(x+t->h_char*4,y);
  1538. X        if ( i >= -1 )
  1539. X            (*t->point)(x+t->h_char*4+t->h_tic*2,y,i);
  1540. X        y -= t->v_char;
  1541. X    }
  1542. X    /* test some arrows */
  1543. X    (*t->linetype)(0);
  1544. X    x = xmax/4;
  1545. X    y = ymax/4;
  1546. X    xl = t->h_tic*5;
  1547. X    yl = t->v_tic*5;
  1548. X    (*t->arrow)(x,y,x+xl,y,TRUE);
  1549. X    (*t->arrow)(x,y,x+xl/2,y+yl,TRUE);
  1550. X    (*t->arrow)(x,y,x,y+yl,TRUE);
  1551. X    (*t->arrow)(x,y,x-xl/2,y+yl,FALSE);
  1552. X    (*t->arrow)(x,y,x-xl,y,TRUE);
  1553. X    (*t->arrow)(x,y,x-xl,y-yl,TRUE);
  1554. X    (*t->arrow)(x,y,x,y-yl,TRUE);
  1555. X    (*t->arrow)(x,y,x+xl,y-yl,TRUE);
  1556. X    /* and back into text mode */
  1557. X    (*t->text)();
  1558. X}
  1559. X
  1560. X
  1561. X#ifdef PC
  1562. X/* output for some terminal types must be binary to stop non Unix computers
  1563. X   changing \n to \r\n. 
  1564. X   If the output is not STDOUT, the following code reopens outfile 
  1565. X   with binary mode. */
  1566. Xvoid
  1567. Xreopen_binary()
  1568. X{
  1569. Xchar filename[MAX_ID_LEN+1];
  1570. X
  1571. X    if (strcmp(outstr,"STDOUT")) {
  1572. X        (void) fclose(outfile);
  1573. X        (void) strcpy(filename,outstr+1);    /* remove quotes */
  1574. X        filename[strlen(filename)-1] = '\0';
  1575. X        if ( (outfile = fopen(filename,"wb")) == (FILE *)NULL ) {
  1576. X            if ( (outfile = fopen(filename,"w")) == (FILE *)NULL ) {
  1577. X                os_error("cannot reopen file with binary type; output unknown",
  1578. X                    NO_CARET);
  1579. X            } 
  1580. X            else {
  1581. X    os_error("cannot reopen file with binary type; output reset to ascii", 
  1582. X                    NO_CARET);
  1583. X            }
  1584. X        }
  1585. X    }
  1586. X}
  1587. X#endif
  1588. X
  1589. X#ifdef vms
  1590. X/* these are needed to modify terminal characteristics */
  1591. X#include <descrip.h>
  1592. X#include <iodef.h>
  1593. X#include <ttdef.h>
  1594. X#include <tt2def.h>
  1595. X#include <dcdef.h>
  1596. X#include <ssdef.h>
  1597. X#include <stat.h>
  1598. X#include <fab.h>
  1599. Xstatic unsigned short   chan;
  1600. Xstatic int  old_char_buf[3], cur_char_buf[3];
  1601. X$DESCRIPTOR(sysoutput_desc,"SYS$OUTPUT");
  1602. X
  1603. Xstatic char *vms_init()
  1604. X/*
  1605. X * Determine if we have a regis terminal
  1606. X * and save terminal characteristics
  1607. X*/
  1608. X{
  1609. X   /* Save terminal characteristics in old_char_buf and
  1610. X   initialise cur_char_buf to current settings. */
  1611. X   int i;
  1612. X   sys$assign(&sysoutput_desc,&chan,0,0);
  1613. X   sys$qiow(0,chan,IO$_SENSEMODE,0,0,0,old_char_buf,12,0,0,0,0);
  1614. X   for (i = 0 ; i < 3 ; ++i) cur_char_buf[i] = old_char_buf[i];
  1615. X   sys$dassgn(chan);
  1616. X
  1617. X   /* Test if terminal is regis */
  1618. X   if ((cur_char_buf[2] & TT2$M_REGIS) == TT2$M_REGIS) return("regis");
  1619. X   return(NULL);
  1620. X}
  1621. X
  1622. Xstatic void
  1623. Xvms_reset()
  1624. X/* set terminal to original state */
  1625. X{
  1626. X   int i;
  1627. X   sys$assign(&sysoutput_desc,&chan,0,0);
  1628. X   sys$qiow(0,chan,IO$_SETMODE,0,0,0,old_char_buf,12,0,0,0,0);
  1629. X   for (i = 0 ; i < 3 ; ++i) cur_char_buf[i] = old_char_buf[i];
  1630. X   sys$dassgn(chan);
  1631. X}
  1632. X
  1633. Xstatic void
  1634. Xterm_mode_tek()
  1635. X/* set terminal mode to tektronix */
  1636. X{
  1637. X   long status;
  1638. X   if (outfile != stdout) return; /* don't modify if not stdout */
  1639. X   sys$assign(&sysoutput_desc,&chan,0,0);
  1640. X   cur_char_buf[0] = 0x004A0000 | DC$_TERM | (TT$_TEK401X<<8);
  1641. X   cur_char_buf[1] = (cur_char_buf[1] & 0x00FFFFFF) | 0x18000000;
  1642. X
  1643. X   cur_char_buf[1] &= ~TT$M_CRFILL;
  1644. X   cur_char_buf[1] &= ~TT$M_ESCAPE;
  1645. X   cur_char_buf[1] &= ~TT$M_HALFDUP;
  1646. X   cur_char_buf[1] &= ~TT$M_LFFILL;
  1647. X   cur_char_buf[1] &= ~TT$M_MECHFORM;
  1648. X   cur_char_buf[1] &= ~TT$M_NOBRDCST;
  1649. X   cur_char_buf[1] &= ~TT$M_NOECHO;
  1650. X   cur_char_buf[1] &= ~TT$M_READSYNC;
  1651. X   cur_char_buf[1] &= ~TT$M_REMOTE;
  1652. X   cur_char_buf[1] |= TT$M_LOWER;
  1653. X   cur_char_buf[1] |= TT$M_TTSYNC;
  1654. X   cur_char_buf[1] |= TT$M_WRAP;
  1655. X   cur_char_buf[1] &= ~TT$M_EIGHTBIT;
  1656. X   cur_char_buf[1] &= ~TT$M_MECHTAB;
  1657. X   cur_char_buf[1] &= ~TT$M_SCOPE;
  1658. X   cur_char_buf[1] |= TT$M_HOSTSYNC;
  1659. X
  1660. X   cur_char_buf[2] &= ~TT2$M_APP_KEYPAD;
  1661. X   cur_char_buf[2] &= ~TT2$M_BLOCK;
  1662. X   cur_char_buf[2] &= ~TT2$M_DECCRT3;
  1663. X   cur_char_buf[2] &= ~TT2$M_LOCALECHO;
  1664. X   cur_char_buf[2] &= ~TT2$M_PASTHRU;
  1665. X   cur_char_buf[2] &= ~TT2$M_REGIS;
  1666. X   cur_char_buf[2] &= ~TT2$M_SIXEL;
  1667. X   cur_char_buf[2] |= TT2$M_BRDCSTMBX;
  1668. X   cur_char_buf[2] |= TT2$M_EDITING;
  1669. X   cur_char_buf[2] |= TT2$M_INSERT;
  1670. X   cur_char_buf[2] |= TT2$M_PRINTER;
  1671. X   cur_char_buf[2] &= ~TT2$M_ANSICRT;
  1672. X   cur_char_buf[2] &= ~TT2$M_AVO;
  1673. X   cur_char_buf[2] &= ~TT2$M_DECCRT;
  1674. X   cur_char_buf[2] &= ~TT2$M_DECCRT2;
  1675. X   cur_char_buf[2] &= ~TT2$M_DRCS;
  1676. X   cur_char_buf[2] &= ~TT2$M_EDIT;
  1677. X   cur_char_buf[2] |= TT2$M_FALLBACK;
  1678. X
  1679. X   status = sys$qiow(0,chan,IO$_SETMODE,0,0,0,cur_char_buf,12,0,0,0,0);
  1680. X   if (status == SS$_BADPARAM) {
  1681. X      /* terminal fallback utility not installed on system */
  1682. X      cur_char_buf[2] &= ~TT2$M_FALLBACK;
  1683. X      sys$qiow(0,chan,IO$_SETMODE,0,0,0,cur_char_buf,12,0,0,0,0);
  1684. X   }
  1685. X   else {
  1686. X      if (status != SS$_NORMAL)
  1687. X         lib$signal(status,0,0);
  1688. X   }
  1689. X   sys$dassgn(chan);
  1690. X}
  1691. X
  1692. Xstatic void
  1693. Xterm_mode_native()
  1694. X/* set terminal mode back to native */
  1695. X{
  1696. X   int i;
  1697. X   if (outfile != stdout) return; /* don't modify if not stdout */
  1698. X   sys$assign(&sysoutput_desc,&chan,0,0);
  1699. X   sys$qiow(0,chan,IO$_SETMODE,0,0,0,old_char_buf,12,0,0,0,0);
  1700. X   for (i = 0 ; i < 3 ; ++i) cur_char_buf[i] = old_char_buf[i];
  1701. X   sys$dassgn(chan);
  1702. X}
  1703. X
  1704. Xstatic void
  1705. Xterm_pasthru()
  1706. X/* set terminal mode pasthru */
  1707. X{
  1708. X   if (outfile != stdout) return; /* don't modify if not stdout */
  1709. X   sys$assign(&sysoutput_desc,&chan,0,0);
  1710. X   cur_char_buf[2] |= TT2$M_PASTHRU;
  1711. X   sys$qiow(0,chan,IO$_SETMODE,0,0,0,cur_char_buf,12,0,0,0,0);
  1712. X   sys$dassgn(chan);
  1713. X}
  1714. X
  1715. Xstatic void
  1716. Xterm_nopasthru()
  1717. X/* set terminal mode nopasthru */
  1718. X{
  1719. X   if (outfile != stdout) return; /* don't modify if not stdout */
  1720. X   sys$assign(&sysoutput_desc,&chan,0,0);
  1721. X   cur_char_buf[2] &= ~TT2$M_PASTHRU;
  1722. X   sys$qiow(0,chan,IO$_SETMODE,0,0,0,cur_char_buf,12,0,0,0,0);
  1723. X   sys$dassgn(chan);
  1724. X}
  1725. X
  1726. Xstatic void
  1727. Xreopen_binary()
  1728. X/* close the file outfile outfile and reopen it with binary type
  1729. X   if not already done or outfile == stdout */
  1730. X{
  1731. X   stat_t stat_buf;
  1732. X   char filename[MAX_ID_LEN+1];
  1733. X   if (outfile != stdout) { /* don't modify if not stdout */
  1734. X      if (!fstat(fileno(outfile),&stat_buf)) {
  1735. X         if (stat_buf.st_fab_rfm != FAB$C_FIX) {
  1736. X            /* modify only if not already done */
  1737. X            (void) fclose(outfile);
  1738. X            (void) strcpy(filename,outstr+1);   /* remove quotes */
  1739. X            filename[strlen(filename)-1] = '\0';
  1740. X            (void) delete(filename);
  1741. X            if ((outfile = fopen(filename,"wb","rfm=fix","bls=512","mrs=512"))
  1742. X                == (FILE *)NULL ) {
  1743. X               if ( (outfile = fopen(filename,"w")) == (FILE *)NULL ) {
  1744. X                 os_error("cannot reopen file with binary type; output unknown",
  1745. X                           NO_CARET);
  1746. X               }
  1747. X               else {
  1748. X          os_error("cannot reopen file with binary type; output reset to ascii",
  1749. X                           NO_CARET);
  1750. X               }
  1751. X            }
  1752. X         }
  1753. X      }
  1754. X      else{
  1755. X         os_error("cannot reopen file with binary type; output remains ascii",
  1756. X                  NO_CARET);
  1757. X      }
  1758. X   }
  1759. X}
  1760. X
  1761. Xstatic void
  1762. Xfflush_binary()
  1763. X{
  1764. X   typedef short int INT16;     /* signed 16-bit integers */
  1765. X   register INT16 k;            /* loop index */
  1766. X   if (outfile != stdout) {
  1767. X       /* Stupid VMS fflush() raises error and loses last data block
  1768. X          unless it is full for a fixed-length record binary file.
  1769. X          Pad it here with NULL characters. */
  1770. X       for (k = (INT16)((*outfile)->_cnt); k > 0; --k)
  1771. X          putc('\0',outfile);
  1772. X       fflush(outfile);
  1773. X   }
  1774. X}
  1775. X#endif
  1776. END_OF_FILE
  1777. if test 53371 -ne `wc -c <'gterm.c'`; then
  1778.     echo shar: \"'gterm.c'\" unpacked with wrong size!
  1779. fi
  1780. # end of 'gterm.c'
  1781. fi
  1782. echo shar: End of archive 5 \(of 5\).
  1783. cp /dev/null ark5isdone
  1784. MISSING=""
  1785. for I in 1 2 3 4 5 ; do
  1786.     if test ! -f ark${I}isdone ; then
  1787.     MISSING="${MISSING} ${I}"
  1788.     fi
  1789. done
  1790. if test "${MISSING}" = "" ; then
  1791.     echo You have unpacked all 5 archives.
  1792.     rm -f ark[1-9]isdone
  1793. else
  1794.     echo You still need to unpack the following archives:
  1795.     echo "        " ${MISSING}
  1796. fi
  1797. ##  End of shell archive.
  1798. exit 0
  1799.  
  1800.